// hooks/useMouseDrag.js
export const useMouseDrag = (sliderBar, onVerify) => {
  const startDrag = (event) => {
    const startX = event.clientX - sliderBar.value.offsetLeft;
    const drag = (event) => {
      sliderBar.value.style.left = event.clientX - startX + 'px';
    };
    const stopDrag = () => {
      document.removeEventListener('mousemove', drag);
      document.removeEventListener('mouseup', stopDrag);
      onVerify(sliderBar.value.offsetLeft);
    };
    document.addEventListener('mousemove', drag);
    document.addEventListener('mouseup', stopDrag);
  };
  return startDrag;
};